#ifndef ITEMEDITDLG_H
#define ITEMEDITDLG_H

#include <QLabel>
#include <QDialog>
#include <QVector>
#include <QString>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>

#include "ItemType.h"

class ItemEditDlg : public QDialog
{
    Q_OBJECT
private:
    int FieldNumber;
    int VisibleNumber;
    int KeyField;
    ItemType item;
    QVector<QLabel*>     Labels;
    QVector<QLineEdit*>  Edits;

    QVBoxLayout* LabelsLayout;
    QVBoxLayout* EditLinesLayout;
    QHBoxLayout* ControlButtonsLayout;
    QVBoxLayout* ItemDialogLayout;
    QHBoxLayout* EditFieldLayout;

    QPushButton* OkButton;
    QPushButton* CancelButton;

private slots:
    void okPressed();

signals:
    void ItemMade( const ItemType& item );

public:
    ItemEditDlg( const QVector<QString> headers, int fieldNumber, int keyField, QWidget* parent );
    ~ItemEditDlg();

    bool SetItem( const ItemType& item );
};

#endif // ITEMEDITDLG_H
